Ext.namespace("Task.Main");

Task.Main.tabIndex = {
	"taken" : 0,
	"unfinished": 0,
	"finished" : 1,
	"expiredTask" : 3,
	"deptTask":2,
	"needFeedBack":4
};

Task.Main.panel = function(taskType) {
	var flag="";
	
	 var conn = new Ext.data.Connection({
   		url:'../security/checkMenu.form?timesnap=' + Date.parse(new Date()),
    	method:'post'
 	});
	
	 if(flag=="true"){
   		var opentab = Utils.getParameter('opentab');
   		if (!opentab) opentab = "taken";
   
   		this.tabPanel = new Ext.TabPanel({
    	region:'center',
    	activeTab: Task.Main.tabIndex[opentab]
   });
	
	
	
	var opentab = Utils.getParameter('opentab');
	if (!opentab) opentab = "taken";
	
	
	this.tabPanel = new Ext.TabPanel({
		region:'center',
		activeTab: Task.Main.tabIndex[opentab]
	});
	
	
	
  this.tabPanel = new Ext.TabPanel({
    region:'center',
    activeTab: Task.Main.tabIndex[opentab]
   });
   var taskOrigin = Utils.getParameter('taskOrigin');
   var outTime=Utils.getParameter('outTime');
   
   if(!Task.Open.panel.instance)
    Task.Open.panel.instance = new Task.Open.panel(taskOrigin,outTime);
   this.tabPanel.add(Task.Open.panel.instance);
   if(!Task.Close.panel.instance)
    Task.Close.panel.instance = new Task.Close.panel();
   this.tabPanel.add(Task.Close.panel.instance);
   if(!Task.SearchPanel.panel.instance)
    Task.SearchPanel.panel.instance = new Task.SearchPanel.panel();
   this.tabPanel.add(Task.SearchPanel.panel.instance);
   /*if(!Task.ExpiredTask.panel.instance)
    Task.ExpiredTask.panel.instance = new Task.ExpiredTask.panel();
   this.tabPanel.add(Task.ExpiredTask.panel.instance);
   
   if(!Task.NeedFeedBackTask.panel.instance)
    Task.NeedFeedBackTask.panel.instance = new Task.NeedFeedBackTask.panel();
   this.tabPanel.add(Task.NeedFeedBackTask.panel.instance);
   */
   if(!Task.ReviewPanel.panel.instance)
    Task.ReviewPanel.panel.instance = new Task.ReviewPanel.panel();
   this.tabPanel.add(Task.ReviewPanel.panel.instance);
   
   Task.Main.panel.superclass.constructor.call(this, {
    layout:'border',
    items:[this.tabPanel],
    listeners:{
    }
   });
 }
};
Ext.extend(Task.Main.panel, Ext.Viewport, {

});

Ext.onReady(function() {
    Ext.QuickTips.init();
    Ext.form.Field.prototype.msgTarget = 'side';
    Ext.BLANK_IMAGE_URL = '../resources/images/default/s.gif';
   	Task.Main.panel.instance = new Task.Main.panel();
   
});

